﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace GiMess
{
    public partial class MoveForm : Form
    {
        private string result = "";
        private bool gotResult = false;

        public MoveForm()
        {
            InitializeComponent();
        }

        public MoveForm(string[] groups)
        {
            InitializeComponent();

            groupsList.Items.AddRange(groups);
        }

        private void okButton_Click(object sender, EventArgs e)
        {
            result = (string)groupsList.SelectedItem;
            gotResult = true;
        }

        private void cancelButton_Click(object sender, EventArgs e)
        {
            gotResult = true;
        }

        public string GetResult()
        {
            while (!gotResult)
                Application.DoEvents();
            Exists = false;
            return result;
        }   

        public static bool Exists { get; set; }
    }
}
